﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SGRapidForm.Permission.Service.Interface;
using SGRapidForm.Common;
using SGRapidForm.Permission.Entity;

namespace SGDemo.Permission
{
     
    public partial class HelpItem : System.Web.UI.Page
    {
        private IPermissionService _permissionService = ServiceProxyFactory.Create<IPermissionService>("permissionservice");
        protected void Page_Load(object sender, EventArgs e)
        {
             JSManager.RegAjax(Header, this.GetType().BaseType);
        }
        /// <summary>
        /// 查询明细
        /// </summary>
        /// <param name="keyid"></param>
        /// <returns></returns>
        [AjaxPro.AjaxMethod]
        public Help GetByKeyid(string keyid)
        {

            return _permissionService.Help_GetByKeyid(keyid);
        }

        /// <summary>
        /// 新增保存
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        [AjaxPro.AjaxMethod]
        public bool SaveForAdd(Help help, string body)
        {
            help.CreateName = ApplicationContext.Current.RealName;
            help.CreateDate = System.DateTime.Now;
            help.Body = body;
            return _permissionService.Help_Add(help);
        }

        /// <summary>
        /// 编辑保存
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        [AjaxPro.AjaxMethod]
        public bool SaveForEdit(Help help, string body)
        {
            help.ModifyName = ApplicationContext.Current.RealName;
            help.ModifyDate = System.DateTime.Now;
            help.Body = body;
            bool ret = _permissionService.Help_Update(help);
            return ret;
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="keyid">用户Keyid</param>
        /// <returns></returns>
        [AjaxPro.AjaxMethod]
        public bool Delete(string keyid)
        {
            return _permissionService.Help_Delete(keyid);
        }
    }
}